package com.emr.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.emr.dao.ILoginDao;
import com.emr.service.LoginService;
import com.emr.vo.MessageVo;
import com.emr.vo.User;

@Service
public class LoginServiceImpl implements LoginService {

	@Resource
	private ILoginDao loginDAOimpl;
	private int totalNum = 0;
	private int totalPage = 0;
	
	@Override
	public MessageVo delete(User user) {
		return loginDAOimpl.delete(user);
	}

	@Override
	public MessageVo save(User user) {
		return loginDAOimpl.save(user);
	}
	
	@Override
	public MessageVo update(User user) {
		return loginDAOimpl.update(user);
	}
	
	@Override
	public MessageVo executeSql(String sql, Object[] obj) {
		return loginDAOimpl.executeSql(sql, obj);
	}

	@Override
	public List<User> getList(User user, int pageNum, int pageSize) {
		if (pageNum <= 0) {
			pageNum = 1;
		}
		if (pageSize <= 0) {
			pageSize = 1;
		}
		List<User> list = loginDAOimpl.getList(user, pageNum, pageSize);
		this.totalNum = loginDAOimpl.getTotalNum();
		this.totalPage = loginDAOimpl.getTotalPage();
		return list;
	}
	
	@Override
	public User getOne(User user) {
		return loginDAOimpl.getOne(user);
	}
	
	@Override
	public int getTotalNum() {
		return totalNum;
	}

	@Override
	public int getTotalPage() {
		return totalPage;
	}


	
}
